package cn.getech.data.development.constant;

import lombok.Getter;


@Getter
public enum JobTypeEnum {
    WORKFLOW(0, "作业流"),
    WORKFLOW_DEP(1, "作业流依赖"),
    ;

    Integer code;
    String name;

    JobTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
    * @Description  根据code获取name
    * @Author  chengweiping
    * @Date   2021/1/14 10:56
    */
    public static String getWorkflowNameByCode(Integer code) {
        if(code==null){
            return null;
        }
        for (JobTypeEnum value : JobTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }
}
